<%@page import="modelo.Item"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page import="modelo.*"%>
<%@page import="DAO.DAOFactory"%>
<%@page import="DAO.ItemDAO"%>



<html>
  
  <head>
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
    <title>
      Waiters
    </title>
   
    <link rel="shortcut icon" href="images/icons/icone.png" />
    <link rel="stylesheet" type="text/css" href="css/minified/aui-production.min.css">
    <link id="layout-theme" rel="stylesheet" type="text/css" href="themes/minified/fides/color-schemes/dark-blue.min.css">
    <link rel="stylesheet" type="text/css" href="themes/minified/fides/common.min.css">
    <link rel="stylesheet" type="text/css" href="themes/minified/fides/responsive.min.css">
   
   

    <script type="text/javascript" src="js/minified/aui-production.min.js">
    </script>
     
     <!--[if lt IE 9]>
      <script src="assets/js/minified/core/html5shiv.min.js">
      </script>
      <script src="assets/js/minified/core/respond.min.js">
      </script>
    <![endif]-->
    <!-- Fides Admin CSS Core -->

  </head>
  
  <body>
    
    <!-- ************************ Barra Preta Menu ************************ -->  
    
    
    <div id="page-wrapper" class="demo-example">
    
        <div id="page-header" class="clearfix"> 
        
        <!-- ************************ Canto esquerdo. Logo ************************ -->  
            <div id="header-logo">
            
            <!-- ************************ Botao de recuar Menu  ************************ -->  
            
                <a href="javascript:;" class="tooltip-button" data-placement="bottom" title="" id="close-sidebar" data-original-title="Fechar Menu">
                <i class="glyph-icon icon-caret-left"></i> </a> <!-- Icone do botao Menu para Esquerda -->
                 
                <a href="javascript:;" class="tooltip-button hidden" data-placement="bottom" title="" id="rm-close-sidebar" data-original-title="Abrir Menu">
                <i class="glyph-icon icon-caret-right"></i> </a> <!-- Icone do botao Menu para Esquerda -->

                <img src="images/logo/logo1.png" width="153" height="46">  <!-- Logo -->
                
            </div>
    
    <!-- ************************ Menu do Lado Direito ************************ -->
        
        <div class="user-profile dropdown"> <!-- Usuario Logado -->
          
            <a href="javascript:;" title="" class="user-ico clearfix" data-toggle="dropdown"><i class="glyph-icon icon-gears"> </i> 
            	<span>Arthur</span> <i class="glyph-icon icon-chevron-down"></i> </a>
            
                <ul class="dropdown-menu float-right">
                    <li>
                        <a href="Empresa.jsp" title="Eitar o seu Perfil"> <i class="glyph-icon icon-user mrg5R"></i> Empresa </a>
                    </li>
                    
                    <li>
                        <a href="Funcionario-consultar.jsp" title="Editar o Perfil dos Funcionarios"> <i class="glyph-icon icon-cog mrg5R"></i> Funcionarios </a>
                    </li>
                    
                    <li>
                        <a href="javascript:;" title="Sair do Sistema"> <i class="glyph-icon icon-signout font-size-13 mrg5R"></i>
                        	<span class="font-bold">Sair</span>  </a>
                   </li>
                </ul>
        </div>
    </div>
       
      
      <!-- ************************ Barra Lado Esquedo - MENU  ************************ -->
      
    <div id="page-sidebar" class="scrollable-content" tabindex="5003" style="overflow: hidden; outline: none; height: 1315px;">
    
        <div id="sidebar-menu" class="active">
        
            
            <ul>
                <li class="current-page"> <a href="Principal.jsp" title="Home"> <i class="glyph-icon icon-home"></i> Home </a> </li>
                
                <li> <a href="Pedidos.jsp" title="Pedidos"> <i class="glyph-icon icon-reorder"></i> Pedidos </a>
                    <ul>
                        <li><a href="#" title="Pedidos atuais"><i class="glyph-icon icon-chevron-right"></i>Atual </a></li>
                        <li><a href="#" title="Pedidos anteriores"><i class="glyph-icon icon-chevron-right"></i> Anteriores </a></li>
                    </ul>
                </li>
                
                <li><a href="javascript:;" title="Relatórios"><i class="glyph-icon icon-bar-chart"></i>Relatórios</a>
                    <ul>
                        <li><a href="Relatorio-fluxo-de-caixa.jsp" title="Relatórios de fluxo de caixa">
                        	<i class="glyph-icon icon-chevron-right"></i>Fluxo de Caixa</a></li>
                            
                        <li><a href="Relatorio-Estatistica-de-pedidos.jsp" title="Estatística de produtos consumidos">
                        	<i class="glyph-icon icon-chevron-right"></i>Estatística de Produtos</a></li>
                            
                        <li><a href="Relatorio-Estatistica-de-consumo.jsp" title="Estatística do periodo de consumo">
                        	<i class="glyph-icon icon-chevron-right"></i>Estatística de Consumo</a></li>
                    </ul>
                </li>
                
                <li><a href="javascript:;" title="Relatórios"><i class="glyph-icon icon-book"></i>Cardápio</a>
                    <ul>
                        <li><a href="Cardapio.jsp" title="Relatórios de fluxo de caixa">
                        	<i class="glyph-icon icon-chevron-right"></i>Produto</a></li>
                            
                        <li><a href="Item.jsp" title="Estatística de produtos consumidos">
                        	<i class="glyph-icon icon-chevron-right"></i>Ingredientes</a></li>
                    </ul>
                </li>
            </ul>
        </div>
	</div>
  </div>
        
  
    <!-- # Fim Menu -->
    
    <form action="ManterItem" method="post" class="cadastrarItem">
          <input type="hidden" name="operacao" value="salvarCadastroItem" >
          
    
    <div id="page-content-wrapper" style="margin-left: 220px;"><!-- Posicionamento do Conteudo -->
     
      <div id="page-title"> <!-- Sub-Titulo -->
        <h3>
          Ingrediente
          <small>
            Cadastre os Ingredientes
          </small>
        </h3>
      </div> <!-- Fim do Sub-Titulo -->
     
     
      <div id="page-content">
         
        <!-- pagina do Conteudo -->
        <div class="form-row ">
          <!-- Linha do botao ingredientes -->
          <div class="form-label form-vertical col-md-2">
            <!-- ingredientes fixo -->
            <label for="">
              <font>
                Ingrediente
              </font>
            </label>
          </div>
          <div class="form-input col-md-2">
            <input placeholder="Digite o Item" type="text" class="" name="nomeItem">
          </div>
           <button class="btn medium bg-green salvar-categoria " type="submit">Salvar</button>
        </div>
      
        <div class="form-row">
          <!-- Linha do combo box Ingredientes -->
          <div class="form-label col-md-2 ">
            <label for="">
              <font>
                Categoria:
              </font>
            </label>
          </div>
          
          <%
          		String sql = "";
      			ItemDAO dao = DAOFactory.obterItemDao();
          
          			sql = "categoria";
            		List retornoCategoria = dao.consultarItem(sql);
          %>  
                
          <!-- Combo Box Ingrediente-->
          <div class="form-input col-md-3">
          
            <select class="form-input col-md-10 add-categoria ingrediente" id="ingrediente" name="categoria-ingrediente">
           	 <option value="" selected>Selecionar</option>
            <%
        		if(retornoCategoria != null) {
        			for(Iterator<Item> it = retornoCategoria.iterator(); it.hasNext(); ) {
        				Item item = (Item)it.next();
			%>          
              			<option value="0"><%=item.getNmCategoriaItem() %></option>
            <% 
           				} 
      		    	} 
      		%> 
            </select>
            
          </div>
          <!--fim Combo Box Ingrediente-->
          
          <!--linha do Botao para nova categoria de ingredientes -->
          <div class="col-md-3 nova ">
            <a href="#" class="btn medium bg-blue-alt nova-categoria " title="">
            <span class="button-content">Nova Categoria de Ingredinetes</span>
        	</a>
          </div>
          <!-- fim Botao para nova categoria de ingredientes-->
          
          <div class="col-md-3">
          </div>
          
          <div class="aparecer-caixa">
            <span class="col-md-3">
              <input placeholder="Digite a Categoria" type="text" id="input-caixa" name="categoriaItem" id="categoriaItem">
            </span>
            <!-- botao de salvar a categoria de ingredientes -->
          </div>
          <!--fim do botao de salvar a categoria de ingredientes -->
        </div>
        
        <div class="divider">
        </div>
        
        <div class="example-code">
        
          <table class="table table-striped text-center">
            <thead>
              <tr>
                <th class="text-center"></th> 
                <th><font>Nome</font></th>
                <th><font>Categoria</font></th>
                <th><font>Ações</font></th>
			 </tr>
			 
            <%
            	 sql = "lista";
           		 List retornoLista = dao.consultarItem(sql);	
	            		if(retornoLista != null) {
	            			for(Iterator<Item> it = retornoLista.iterator(); it.hasNext(); ) {
	            				Item item = (Item)it.next();
			%>            
			       
             <tr>
             	<td></td>
				<td class="font-bold text-left"><font><%=item.getNmItem() %></font></td>
              	<td class="font-bold text-left"><font><%=item.getNmCategoriaItem() %></font></td>
             	<td class="font-bold text-left"><div class="dropdown">
                            <a href="javascript:;" title="" class="btn medium bg-blue" data-toggle="dropdown">
                                <span class="button-content">
                                    <i class="glyph-icon font-size-11 icon-cog"></i>
                                    <i class="glyph-icon font-size-11 icon-chevron-down"></i>
                                </span>
                            </a>
                            
                            <ul class="dropdown-menu float-right">
                       
                     
                      <li class="divider">
                      </li>
                     </form> 
                      <form action="ManterItem" method="post">
    							<input type="hidden" name="operacao" value="excluirItem">
                                	<li><button type="submit" name="codItem" value="<%=item.getCodItem()%>"><a href="javascript:;" class="font-red" title="">
                                    	<i class="glyph-icon icon-remove mrg5R"></i>
                                    		<font>Excluir</font>
                                    	</a></button>
                                	</li>
                                </form>
                            </ul>                   
                        </div>
                 </td>
             </tr>
					<% } 
      		    } %> 
      		    
      		   </thead>
      		  </table>

                </td>
              </tr>
   
            </tbody>
       
          </table>
        </div>
        
      </div>
      
   
    </div>
  </body>

</html>